<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let obj1 = {
      age: 18
    }
    let obj2 = {
      name: 'tom'
    }
    console.log(Object.assign(obj1, obj2))
    console.log('obj1:', obj1)
  </script>

</body>

</html>